package com.hcc.gateway.netty.exception;

import com.hcc.gateway.netty.context.GatewayExchange;
import com.hcc.gateway.netty.context.RespContext;
import com.hcc.gateway.netty.support.WriteRespUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * DefaultGatewayExceptionHandler
 *
 * @author shengjun.hu
 * @date 2021/12/27
 */
@Slf4j
public class DefaultGatewayExceptionHandler implements GatewayExceptionHandler {

    @Override
    public void handle(GatewayExchange exchange, Throwable t) {
        RespContext respContext = exchange.getRespContext();
        WriteRespUtils.writeRespFor500(respContext, t);
    }

}
